<?php
abstract class ApptEncoder//数据编码器
{
    abstract function encode();
}
class BloggsApptEncoder extends ApptEncoder//Bloggs 数据型
{
    function encode()
    {
        return "Appointment data encodeed in BloggsCla format <br>";
    }
}
class MegaApptEncoder extends ApptEncoder//Megaappt 
{
    function encode()
    {
        return "Apponintment data encoded in Megacal format <br>";
    }
}
abstract class CommsManager_abstract
{
    abstract function getHeaderText();
    abstract function getApptEncoder();
    abstract function getFooterText();
}
class CommsManager  
// 这个作用是啥东西啊？
{
    const BLOGGS = 1;
    const MEGA = 2; //const 的常量前面不需要添加$
    private $mode = 1;
    function __construct($mode)
    {
        $this->mode = $mode;
    }
    function getApptEncoder()//最后的转码 然后输出到网页上 假设
                            //encode lastly,and then input content to website.i suppose;
    {
        switch ($this->mode) {
            case (self::MEGA):
                return new EMEgaApptEncoder();
            default:
                return new BloggsApptEncoder();
        }
    }
}
class BloggsCommsManager extends CommsManager_abstract   //
{
    function getHeaderText()
    {
        return "BloggsCla Header <br>";
    }
    function getApptEncoder()
    {
        return "BloggsClas content <br>";
    }
    function getFooterText()
    {
        return "BloggsClas content <br>";
    }
}


?>